<template>
  <notice-modal
      :title="title"
      :visible="visible"
      :bodyStyle ="bodyStyle"
      :switchFullscreen="switchFullscreen"
      @cancel="handleCancel"
  >
    <template slot="footer">
      <a-button key="back" @click="handleCancel">关闭</a-button>
      <a-button v-if="record.openType==='url'" type="primary" @click="toHandle">去处理</a-button>
    </template>
    <a-card class="daily-article" :loading="loading">
      <a-card-meta
          :title="record.noticeTitle"
          :description="'发布人：'+record.senderName + ' 发布时间： ' + record.sendTime">
      </a-card-meta>
      <a-divider />
      <span v-html="record.noticeContent" class="article-content"></span>
    </a-card>
  </notice-modal>
</template>

<script>

import NoticeModal from './NoticeModal.vue'
export default {
  name: "SysNoticeModal",
  components: {
    NoticeModal
  },
  data () {
    return {
      title:"通知消息",
      record: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      visible: false,
      switchFullscreen: true,
      loading: false,
      bodyStyle:{
        "padding": "0",
        "max-height":(window.innerHeight*0.7)+"px",
        "overflow-y":"auto",
      },
    }
  },
  created () {
  },
  methods: {
    detail (record) {
      this.visible = true;
      this.record = record;
    },
    handleCancel () {
      this.visible = false;
    },
    toHandle(){
      if(this.record.openType==='url'){
        this.visible = false;
        //链接跳转
        this.$router.push({path: this.record.openPage})
      }
    },
  }
}
</script>
<style scoped lang="less">
.daily-article {
  .article-button {
    font-size: 1.2rem !important;
  }
  .ant-card-body {
    padding: 18px !important;
  }
  .ant-card-head {
    padding: 0 1rem;
  }
  .ant-card-meta {
    margin-bottom: 1rem;
  }
  .article-content {

  }
}
</style>
